//Copyright (C) 2007 James Ashley (www.imaginativeuniversal.com) under the terms of the LGPL.
using System;
using System.Collections.Generic;
using System.Text;
using System.Speech.Recognition;

namespace SophiaBot
{
    public interface IBotServer
    {

        event GenericEventHandler<IBotServer, string> OnBotInfoResponse;

        event GenericEventHandler<IBotServer, string> OnBotResponse;

        event GenericEventHandler<string> OnUserInput;

        event GenericEventHandler<string> OnTextRecognized;

        event EventHandler<FinishEventArgs> OnFinish;

        event EventHandler OnStart;

        bool IsRunning
        {
            get;
        }

        string Name
        {
            get;
        }

        int Priority
        {
            set;
        }

        void AddNextBot(IBotServer bot);

        void Read(string inputText);

        Grammar[] GetGrammars();

        string GetStatus();

        void Start();

        void Start(string val);

        void Stop();

    }

    public delegate void GenericEventHandler<T>(T val);
    public delegate void GenericEventHandler<B,T>(B source, T val) where B: IBotServer;

    public class FinishEventArgs : EventArgs
    {
        private string _message;
        private IBotServer _iBot;

        internal FinishEventArgs(IBotServer iBot, string messageData)
        {
            _iBot = iBot;
            _message = messageData;
        }

        private FinishEventArgs() { }

        public string Message
        {
            get { return _message; }
            set { _message = value; }
        }

        public new static FinishEventArgs Empty
        {
            get { return new FinishEventArgs(); }
        }
    }

}
